//package com.mastercard.util;
//
//import java.util.Properties;
//
//import javax.mail.Message;
//import javax.mail.MessagingException;
//import javax.mail.PasswordAuthentication;
//import javax.mail.Session;
//import javax.mail.Transport;
//import javax.mail.internet.AddressException;
//import javax.mail.internet.InternetAddress;
//import javax.mail.internet.MimeMessage;
// 
//public class Util {
// 
//	public static void sendEmail(String [] to, String subject, String content) throws AddressException, MessagingException{
//		final String username = "mpems.mastercard@gmail.com";
//		final String password = "se19team2s";
//		String host = "smtp.gmail.com";
//	    Properties props = System.getProperties();
//	    props.put("mail.smtp.starttls.enable", "true"); // added this line
//	    props.put("mail.smtp.host", host);
//	    props.put("mail.smtp.user", username);
//	    props.put("mail.smtp.password", password);
//	    props.put("mail.smtp.port", "587");
//	    props.put("mail.smtp.auth", "true");
//
//	    Session session = Session.getDefaultInstance(props, null);
//	    MimeMessage message = new MimeMessage(session);
//
//			message.setFrom(new InternetAddress(username));
//		
//
//	    InternetAddress[] toAddress = new InternetAddress[to.length];
//
//	    // To get the array of addresses
//	    for( int i=0; i < to.length; i++ ) { // changed from a while loop
//	        toAddress[i] = new InternetAddress(to[i]);
//	    }
//	   	    for( int i=0; i < toAddress.length; i++) { // changed from a while loop
//	        message.addRecipient(Message.RecipientType.TO, toAddress[i]);
//	    }
//	    message.setSubject(subject);
//	    message.setText(content);
//	    Transport transport = session.getTransport("smtps");
//	    transport.connect(host, username, password);
//	    transport.sendMessage(message, message.getAllRecipients());
//	    transport.close();
//
//	}
//	
//	public static void main(String[] args) {
// 	    try {
// 	    	sendEmail(new String[]{"guoyucn@gmail.com"}, "subject", "content");
//		} catch (AddressException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (MessagingException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//	}
//}
